package org.example.order.controller;

import org.example.core.utils.PageUtils;
import org.example.core.utils.R;
import org.example.order.dto.OrderDto;
import org.example.order.dto.OrderItemDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.example.order.entity.OrderEntity;
import org.example.order.service.OrderService;



/**
 * @author xiaojie_cc
 * @version 1.0
 */
@RestController
@RequestMapping("/oms/backend/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public R<?> list(OrderDto orderDto){
        PageUtils pageUtils = orderService.list(orderDto);
        return R.ok(pageUtils);
    }

    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public R<?> info(@PathVariable("id") Long id){

        return null;
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    public R<?> save(@RequestBody OrderEntity order){

        return null;
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public R<?> update(@RequestBody OrderEntity order){

        return null;
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public R<?> delete(@RequestBody Long[] ids){

        return null;
    }

    /**
     * 发货
     */
    @PostMapping("/orderItem")
    public R<PageUtils> orderItem(@RequestBody OrderItemDto dto){
        PageUtils pageUtils = orderService.orderItem(dto);
        return R.ok(pageUtils);
    }
}